import React, { Component } from 'react'
import Demo2_forwardRef_Child1 from './Demo2_forwardRef_Child1'
import Demo2_forwardRef_Child2 from './Demo2_forwardRef_Child2';
export class Demo2_forwardRef_Parent extends Component {
  componentDidMount(){
    console.log(this.box);
    console.log(this.box1);
    
  }
  render() {
    return (
      <div>
      <Demo2_forwardRef_Child1 ref={(x)=>{
        this.box=x //这里的x就是该组件传过来的ref
      }} />

      <Demo2_forwardRef_Child2 ref={(x)=>{ 
        this.box1=x //这里x是类组件的实例
        
      }} />
      
      </div>
    )
  }
}

export default Demo2_forwardRef_Parent